package banking.domain;

import banking.domain.Account;
import java.util.*;
/** 
 * This class contains a bunch of documentation tags. 
 * @author ZhangXi 
 * @version 0 
 */ 
public class Customer implements Comparable<Customer>{
	private String firstname;
	private String lastname;
	private Account account;
	public List<Account> accounts;
	public Customer (String f,String l) {
			firstname=f;
			lastname=l;
			accounts=new ArrayList<Account>();
	}
	public String getFirstName() {
			return firstname;
	}
	public String getLastName() {
		return lastname;
	}
	public void setAccount(Account acct) {
			account=acct;
	}
	public Account getAccount() {
			return account;
	}
	public void addAccount(SavingsAccount a) {
			accounts.add(a);
	}
	public void addAccount(CheckingAccount a) {
			accounts.add(a);
	}
	public Account getAccount(int a) {
			return accounts.get(a);
	}
	public void addAccount(Account a) {
			accounts.add(a);
	}
	public int getNumOfAccounts() {
			return accounts.size();
	}
	public Iterator<Account> getAccounts(){
			return accounts.iterator();
	}
	@Override
	public int compareTo(Customer o) {
		if(this.lastname.compareTo(((Customer)o).lastname)!=0)
			return this.lastname.compareTo(((Customer)o).lastname);
		else
			return this.firstname.compareTo(((Customer)o).firstname);
	}
}
